package com.cc2019.buke.home.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;

import com.cc2019.buke.R;
import com.cc2019.buke.home.adapter.PxAdapter;
import com.cc2019.buke.home.entry.Product6;

import java.util.ArrayList;
import java.util.List;

public class PxActivity extends AppCompatActivity {
    private RecyclerView recyclerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_px);
        recyclerView = findViewById(R.id.px_recycleView);
        List<Product6> pro_list = init();
        PxAdapter pxAdapter = new PxAdapter(pro_list,this);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        recyclerView.setLayoutManager(linearLayoutManager);
        recyclerView.setAdapter(pxAdapter);

    }
    public List<Product6> init(){
        ArrayList<Product6> products = new ArrayList<>();
        Product6 product1 = new Product6(1,R.drawable.pxt1,"月光落在左手上","余秀华",58,124107);
        Product6 product2 = new Product6(2,R.drawable.pxt2,"少年读史记","张嘉译",100,117632);
        Product6 product3 = new Product6(3,R.drawable.pxt3,"百年孤独","马尔克斯",39.6,206395);
        Product6 product4 = new Product6(4,R.drawable.pxt4,"心安即是归处","季羡林",42.7,319825);
        Product6 product5 = new Product6(5,R.drawable.pxt5,"你当像鸟飞往你的山","塔拉",34.8,1308627);
        Product6 product6 = new Product6(6,R.drawable.pxt6,"大话中国艺术史","易公子",118,62576);
        Product6 product7 = new Product6(7,R.drawable.pxt7,"法治的细节","罗翔",18.8,99975);
        Product6 product8 = new Product6(8,R.drawable.pxt8,"白夜行","东野圭吾",59.6,193893);
        Product6 product9 = new Product6(9,R.drawable.pxt9,"走遍中国","霍晨新",20.4,452711);
        Product6 product10 = new Product6(10,R.drawable.pxt10,"语言表达","五位太郎",105.8,50834);
        Product6 product11 = new Product6(11,R.drawable.pxt11,"房思琪的初恋乐园","林奕含",45,480325);
        Product6 product12 = new Product6(12,R.drawable.pxt12,"我是学霸","项华",39,362374);
        Product6 product13 = new Product6(13,R.drawable.pxt13,"一间只属于自己的房间","杨澜",45,10285);
        Product6 product14 = new Product6(14,R.drawable.pxt14,"遥远的救世主","豆豆",26.4,371456);
        Product6 product15 = new Product6(15,R.drawable.pxt15,"小熊和最好的爸爸","阿兰德",17.5,153268);
        Product6 product16 = new Product6(16,R.drawable.pxt16,"奇奇怪怪的故事集","莫言",26.9,1563);
        Product6 product17 = new Product6(17,R.drawable.pxt17,"最温柔的教养","乌恩英",38.4,52160);
        Product6 product18 = new Product6(18,R.drawable.pxt18,"暖房子","TROLL",115,896300);

        products.add(product1);products.add(product4);products.add(product7);products.add(product10);products.add(product13);
        products.add(product16);products.add(product17);products.add(product18);
        products.add(product2);products.add(product5);products.add(product8);products.add(product11);products.add(product14);
        products.add(product3);products.add(product6);products.add(product9);products.add(product12);products.add(product15);
        return products;
    }
}